java.lang.Object
ddejonge.bandana.calculators.ScoreCalculator
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
MissedDeadlineScoreCalculator
,PointsCalculator
,RankCalculator
,SoloVictoryCalculator
,SupplyCenterCalculator
public abstract class ScoreCalculator
extends java.lang.Object
implements java.io.Serializable
Abstract base class for the other Score Calculators
- Author:
- Dave de Jonge, IIIA-CSIC
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description boolean
higherIsBetter
-
Constructor Summary
Constructors Constructor Description ScoreCalculator(boolean higherIsBetter)
-
Method Summary
Modifier and Type Method Description void
addResult(GameResult newResult, Team team)
This method is called by the TournamentResult object, after every finished game, for each team.abstract void
calculateGameScore(GameResult newResult, java.lang.String teamName)
Calculates the score of the given team for the given game.java.util.List<java.lang.Double>
getScoreList(java.lang.String teamName)
Returns a list of scores, in which each number represents the total score of the *entire* team in a single game.abstract java.lang.String
getScoreString(java.lang.String teamName)
Returns the string to display in the table of the TournamentObserver.abstract java.lang.String
getScoreSystemName()
Returns the name of this score system.java.util.List<java.lang.String>
getTeamMembers(java.lang.String teamName)
Returns the names of the members of this team.abstract double
getTournamentScore(java.lang.String teamName)
Returns the overall score of the given team for the entire tournament.
-
Field Details
-
higherIsBetter
public final boolean higherIsBetter
-
-
Constructor Details
-
ScoreCalculator
public ScoreCalculator(boolean higherIsBetter)- Parameters:
higherIsBetter
- if this parameter is true, then the player that scores the highest value is ranked highest. If this parameter is false, then the player that scores the lowest value will be ranked highest.
-
-
Method Details
-
addResult
This method is called by the TournamentResult object, after every finished game, for each team. It will get the score for each player by calling calculateGameScore() and adds this score to that player's total.- Parameters:
newResult
-
-
getScoreList
public final java.util.List<java.lang.Double> getScoreList(java.lang.String teamName)Returns a list of scores, in which each number represents the total score of the *entire* team in a single game.- Parameters:
teamName
-- Returns:
-
getTeamMembers
public final java.util.List<java.lang.String> getTeamMembers(java.lang.String teamName)Returns the names of the members of this team.
Note that these names can be either player names or power names.- Parameters:
teamName
-- Returns:
-
calculateGameScore
Calculates the score of the given team for the given game.- Parameters:
newResult
-teamName
-
-
getTournamentScore
public abstract double getTournamentScore(java.lang.String teamName)Returns the overall score of the given team for the entire tournament.
The TournamentObserver will sort the teams based on to the values returned by this method.- Parameters:
name
-- Returns:
-
getScoreSystemName
public abstract java.lang.String getScoreSystemName()Returns the name of this score system.- Returns:
-
getScoreString
public abstract java.lang.String getScoreString(java.lang.String teamName)Returns the string to display in the table of the TournamentObserver.- Parameters:
name
-- Returns:
-